home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
VISUALBA
/
BOZOL2.ZIP
/
BOZOL.DOC
< prev
next >
Wrap
Text File
|
1994-02-08
|
28KB
|
619 lines
1. WHAT IS BOZOL?
2. BOZOL COMMANDS AND FUNCTIONS - STARTER SET
3. BOZOL PROGRAMMING RULES
4. HOW TO ADD COMMANDS AND FUNCTIONS
5. CALLING BOZOL FROM YOUR OWN PROGRAMS
1. WHAT IS BOZOL?
BozoL (The Bozo Language) is an extremely simple interpretive
language written in PowerBASIC. It is designed to be easy to
use, easy to modify, and to run as fast as possible.
Some of the rules in BozoL may seem a bit wierd, but there is a
reason for this. After writing a BASIC interpreter (EBASIC.ZIP)
I discovered that the fundamental design of BASIC makes it
extremely difficult to parse and interpret with any sort of
reasonable speed. BozoL is purposely designed to run as fast
as possible as an interpreted language.
Why BozoL?
Every now and then a situation may arise where you will want to
incorporate a command language into your programs. BozoL can be
easily modified to do things relevant to your program's needs.
Suppose you have a database program and you want to allow your
users to program their own custom procedures without having to
go back to the original source code and add them in.
BozoL is a language skeleton. All of the dirty work has been
done already. BozoL already contains expression parsing, program
flow control, basic logic, and other fundamental building blocks
of a programming language (print, input, variables, etc).
BozoL is simple. There are not a lot of rules, punctuation, or
wierd symbols in the language. It is a real beginner's language.
All you need to do now is add your own custom commands and key-
words to the language. See section 4, "How to add commands and
functions" for the exact details on how to do this.
Prototypes and Applications
Suppose you have a library of routines that pop up boxes, print
menus, display pictures, etc. You can take these routines and
make BozoL commands out of them. For instance, if you have a
PowerBASIC subroutine that displays a message inside a red box
on the center of the screen, you can make a BozoL command which
calls this subroutine. So now in BozoL you can say
REDBOX "press any key to continue!"
and BozoL will call your subroutine. Using this technique, you
can take an entire library, or many libraries, and make BozoL
commands out of all of those subroutines.
I'll give you a more advanced example. Suppose you have a Power-
BASIC library that features pull-down menus, dialog boxes, list
boxes, a text editor, and data entry screens. If you took every
callable SUB and FUNCTION in this library and made BozoL commands
out of them, then you could use the BozoL language to write
really neat user-interface programs, prototypes, or even finished
products. Instead of shipping an EXE, you can ship the BozoL
interpreter along with an interpreted BozoL program that can
be easily modified by your customers without ever having to
give them the source code or customizing the program yourself.
Software upgrades could be faxed to your customers or even
dictated over the phone.
Process Control
You could use BozoL to control machinery. You could add commands
like TURN EVERYTHING OFF or DISPLAY STATUS OF MIXER 1. By inventing
commands and adding them to the language you could turn BozoL into
a high level language that does almost anything, for any purpose.
Users could enter direct statements or run programs that display
menus and perform certain tasks, and easily add to or modify the
system without a lot of complicated programming. Consider these
possible additions to the language:
DISPLAY SCHEMATIC
BLOCK PHONES
ELECTRIC FENCES OFF
DISENGAGE SECURITY IN DINOSAUR EMBRYO LAB
With the fundamental building blocks of the language already in
place (like GOTO, GOSUB, IF, LOAD, RUN, SAVE, PRINT, INPUT, LOCATE,
COLOR, LET, etc) you can easily build a custom language that works
well, runs fast, can handle almost any programming task, and can
call subroutines written in BASIC, C, Assembler, or BozoL. Since
most of the nitty gritty is compiled in (like what do do when the
command BLOCK PHONES is issued) it will almost always seem to
run just as fast as a compiled program.
2. BOZOL COMMANDS AND FUNCTIONS - STARTER SET
As I mentioned in part 1, all of the fundamental building blocks
of the language, its structure, variable handling and flow control
have already been built in. All you need to do is add new key
words and the code that is executed when BozoL sees the key word.
These are the key words that are built in to BozoL already:
ASC ASCII BE CALC CASE CHR CLS
COLOR CR EQUAL EQUALS EVAL FALSE GOSUB
GOTO IF IN INKEY INPUT IS LCASE
LEFT LEN LET LIST LOAD LOCATE LOWER
LTRIM MID NOT PRINT PROMPT QUIT RETURN
RIGHT RTRIM RUN SAME SAVE SET SUBSTR
TAB TO TRUE UCASE UNTIL UPPER WHAT
WHILE WITH
(... and added since this writing...)
END
See the file BOZOL.REF for a complete description of each command
and examples of how to use them in your programs.
3. BOZOL PROGRAMMING RULES
BozoL is funny for a couple of reasons. First, the syntax is
probably unlike any language you have ever seen. As I mentioned
earlier, this is to make it easier for the interpreter to
parse and execute its statements. Easier means faster.
BozoL also has keywords which don't do anything. The reason for
these keywords is to make the awkward syntax a bit easier to
stomach. Remember these keywords when adding your own commands
to BozoL. They can come in handy.
Keywords that don't do anything:
"TO", "IN", "WITH", "IS", "BE", "EQUAL", "OF", "THE"
You will see me using these in program examples every once in a while.
For instance, to assign a value to a variable you could say
SET A TO 1
Although the word "TO" is not really necessary. You could also
say
SET A 1
but that looks silly and its meaning would not be clear to someone
who does not know all about BozoL (like anyone does but me!).
Which brings up another rule: BozoL statements are parsed with
spaces, commas, or semicolons. It does not matter which you use
and it does not matter how you mix them. For instance, these
expressions are all the same:
SET A TO 1
SET A,1
SET;A;1
SET A TO 1
Also, multiple statements can be on the same line. In fact, it
is necessary to put multiple statements on the same line in some
cases. Multiple statements are separated by colons, just like
BASIC.
SET A TO 1: PRINT A: PRINT "GoodBye!":END
Now here's another bit of silliness: BozoL will also allow
you to place multiple statements on a line without using colons
to separate them, BUT if you do not use colons the statements will
be executed in REVERSE ORDER.
For example, if you said
PRINT 1: PRINT 2: PRINT 3
BozoL wou